home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / eflibpt4.zip / DEMO / STREAMS / POLYSTRM.PAS < prev    next >
Pascal/Delphi Source File  |  1996-08-16  |  1KB  |  26 lines

  1. { Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
  2.   Demonstration; polymorphic data streams
  3.  
  4.   EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
  5.   MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
  6.   ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED.                          }
  7.  
  8.  
  9. uses EFLIBIO;
  10.  
  11. var FirstStream, SecondStream : StreamObjectPointerType;
  12.  
  13.  
  14. begin
  15.      FirstStream := New (MemoryStreamObjectPointerType, Initialize (100));
  16.      SecondStream := New (NullStreamObjectPointerType, Initialize);
  17.  
  18.      { The first stream and the second stream uses the same interface, ie.
  19.        allows the same operations to be performed. They are polymorphic.
  20.        Object polymorphism makes it possible to pass any stream to a
  21.        component. The component then can access the stream without knowing
  22.        anything about the stream implementation. »How» the expected
  23.        operations are performed is not of interest. }
  24.  
  25.      FirstStream^.Free; SecondStream^.Free;
  26. end.